/** Corpse entity.
 */
function CorpseEntity()
{
}
CorpseEntity.prototype = new Entity("corpse", "%", Color.white, null, false, false);
CorpseEntity.prototype._bloodPatternData =
[
	0, 0, 0.4,
	-1, 0, 0.15,
	1, 0, 0.15,
	0, -1, 0.15,
	0, 1, 0.15
];
CorpseEntity.prototype._bloodBaseColor = new Color(0.7, 0, 0);
CorpseEntity.prototype.onArriveAtPosition = function(isLoad)
{
	// A little bit of blood spatter, yay!
	var ix, iy, a, i, c;
	for(i = 0; i < this._bloodPatternData.length; i += 3)
	{
		ix = this._bloodPatternData[i + 0];
		iy = this._bloodPatternData[i + 1];
		a = this._bloodPatternData[i + 2] * Math.random() + 0.1;
		var tile = this.parent.getTile(this.x + ix, this.y + iy);
		if(tile)
		{
			c = CorpseEntity.prototype._bloodBaseColor.newScaled(1.1 - Math.random() * 0.2);
			if(tile.bg)
				tile.bg = tile.bg.alphaBlend(c, a);
			if(tile.fg)
				tile.fg = tile.fg.alphaBlend(c, a);
			this.parent.renderPosition(this.x + ix, this.y + iy);
		}
	}
}
Entity.registerCtor(CorpseEntity, 4);
